package com.chengww.grab_rp.api

import com.google.gson.annotations.SerializedName

/**
 * Created by chengww on 2/20/21
 * @author chengww
 */
abstract class BaseResponse(open var error: String?) {
    abstract fun isSuccess(): Boolean
}

data class LoginResponse(
    @SerializedName("plugid") val plugId: String?,
    @SerializedName("token") val token: String?,
    @SerializedName("msg") val msg: String?
) : BaseResponse(msg) {
    override fun isSuccess() = !token.isNullOrEmpty()
}

data class LogoutResponse(
    @SerializedName("code") val code: Int?,
    @SerializedName("msg") val msg: String?
) : BaseResponse(msg) {
    override fun isSuccess() = code != null && code == 0
}

data class GrabDownResponse(
    @SerializedName("code") val code: Int?,
    @SerializedName("msg") val msg: String?
) : BaseResponse(msg) {
    override fun isSuccess() = code != null && code == 0
}